let db = require('../db');

//获取设备信息
exports.getMessageBySerialNum  = async  function (serialNum) {
    let sql=`
    
    select * from  equipment  where isdelete = 'n' AND  SerialNum =:serialNum
    `
    let data  = await db.query(sql,{serialNum});
    return data[0];

}

//添加记录信息

exports.addLog  = async  function(villageId,buildingId,unitId,fileUrl){
let sql=`
 INSERT  INTO log(villageId,buildingId,unitId,url)
 VALUES(:villageId,:buildingId,:unitId,:fileUrl)
`
let data = await db.query(sql,{villageId,buildingId,unitId,fileUrl});
return data[0];
}